-- @owner: songjing20
-- @date: 2024-7-12
-- @testpoint: DQL语法，connect by基表为子查询和cte复合场景

--step1:建表并插入数据;expect:成功
drop table if exists t_connect_001;
create table t_connect_001(id int, lid int, name text);
insert into t_connect_001 values(1,null,'A'),(2,1,'B'),(3,2,'C');

--step2:验证connect by基表为子查询和cte复合场景;expect:查询成功
with t2 as (select * from t_connect_001 where id!=10)
  select level, t.* from (select * from t2 where id!=10 order by id) t start with t.id=2 connect by prior t.id=t.lid;

--step3:清理环境;expect:成功
drop table t_connect_001;
